package com.iwhalecloud.bss.kite.cucc.web.service.goods.modify.impl;

import com.iwhalecloud.bss.kite.client.api.scene.operate.IOperateSceneService;
import com.iwhalecloud.bss.kite.cucc.client.dto.goods.modify.request.AbstractCreateGoodsModifySceneRequest;
import com.iwhalecloud.bss.kite.cucc.client.dto.pos.KitePosDTO;
import com.iwhalecloud.bss.kite.web.context.KiteWebContext;
import com.ztesoft.bss.common.util.ContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DefaultGoodsModifyService extends AbstractGoodsModifyService {

    @Autowired
    private IOperateSceneService operateSceneService;

    @Override
    public String createOfferScene(AbstractCreateGoodsModifySceneRequest request, String custId, String custName, KitePosDTO kitePosDTO) {
        String offerId = request.getTargetOfferId();
        //初始化目标套餐
        String sceneInstId = operateSceneService
            .createOfferSceneInst(request.getServiceOfferId(), offerId, custId, custName,
                ContextUtil.getUserId().toString(), request.getLanId(),
                ContextUtil.getLoginInfo().getUserInfo().getPostRegionId().toString(),
                String.valueOf(ContextUtil.getLoginInfo().getUserInfo().getExtParams().get("session_id")),
                null).getResultObject();
        KiteWebContext.addAndUpdateSceneInstId(sceneInstId);
        return sceneInstId;
    }
}
